﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using dhDataAcess.baseBLL;
using baseSet.importExport;

namespace dhsystem.produceForm
{
    public partial class Frmpackwight : Form
    {
        public Frmpackwight()
        {
            InitializeComponent();
        }

        private void buttworkerselect_Click(object sender, EventArgs e)
        {
            string field;
            field = "pname";
            Frmprodutselect productselect = new Frmprodutselect(moduleInfo.productList, field);
            DialogResult result = productselect.ShowDialog();
            if (result == DialogResult.Yes)
            {
                textPname.Text = productselect.pname;
            }
        }

        private void textPname_TextChanged(object sender, EventArgs e)
        {
            try
            {
                textparkweight.Text = basicSql.getpackwightbyproductList(textPname.Text);
               
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult result = MessageBox.Show("是否修改胚带重量！", "提示信息", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    basicSql.getproductpackwightUpdate1(textPname.Text, textparkweight.Text);
                    MessageBox.Show("修改成功");
                }
            }
            catch(Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }

        private void Frmpackwight_Load(object sender, EventArgs e)
        {

        }
    }
}
